import { S } from '../../s';
import { IPSDEFormDetail } from './ipsdeform-detail';
import { IPSDEFormFormPart } from './ipsdeform-form-part';
import { PSDEFormBaseGroupPanelImpl } from './psdeform-base-group-panel-impl';
import { IPSUIActionGroup } from '../../view/ipsuiaction-group';

export class PSDEFormFormPartImpl
  extends PSDEFormBaseGroupPanelImpl
  implements IPSDEFormFormPart
{
  get actionGroupExtractMode(): 'ITEM' | 'ITEMS' {
    return this.M.actionGroupExtractMode;
  }

  get buildInActions(): number {
    return this.M.buildInActions != null ? this.M.buildInActions : 0;
  }

  get formPartType(): 'FORMRF' | 'DYNASYS' {
    return this.M.formPartType;
  }

  protected psdeformdetails: IPSDEFormDetail[];
  getPSDEFormDetails(): IPSDEFormDetail[] | null {
    return (
      this.psdeformdetails ||
      (this.psdeformdetails = this.fillChildListModel(
        this.M.getPSDEFormDetails,
        S._ab,
      ) as IPSDEFormDetail[])
    );
  }

  findPSDEFormDetail(objKey: any): IPSDEFormDetail | null {
    return this.getPSModel5(
      S._ab,
      this.getPSDEFormDetails(),
      objKey,
    ) as IPSDEFormDetail;
  }

  protected psuiactiongroup: IPSUIActionGroup;
  getPSUIActionGroup(): IPSUIActionGroup | null {
    return (
      this.psuiactiongroup ||
      (this.psuiactiongroup = this.fillObjectModel(
        S._210,
        this.M.getPSUIActionGroup,
        S._2ed,
      ) as IPSUIActionGroup)
    );
  }

  get enableAnchor(): boolean {
    return this.M.enableAnchor != null ? this.M.enableAnchor : false;
  }
  get cls(): string {
    return 'PSDEFormFormPartImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._b2 || cls == S._b3) return true;
    return super.instanceof(cls);
  }
}
